<?php

namespace backend\helpers;

use yii;
use \DateTime as DateTime;

class DateTimeHelper
{
    public static function diffPeriod($dateStartStr, $dateEndStr)
    {
        $_datetime1 = new DateTime($dateStartStr);
        $_datetime2 = new DateTime($dateEndStr);

        $interval = $_datetime1->diff($_datetime2);

        return Yii::t('basis', '{n, plural, one{# day} other{# days}}', ['n' => $interval->format('%a')]);
    }

    public static function getNowDate()
    {
        return date('Y-m-d');
    }

}